package cn.hacynn.nd.mapper;

import cn.hacynn.nd.pojo.entity.TagFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author Hacynn
 * @Date 2024/5/27 15:21
 * @Version 1.0
 */
@Mapper
public interface TagFileMapper extends BaseMapper<TagFile> {

    /**
     * 根据TagId获取所有FileId
     * @param TagId
     * @return
     */
    @Select("select file_id from tag_file where tag_id = #{TagId}")
    List<String> geyByTagId(String TagId);

    /**
     * 根据tagId删除记录
     * @param tagId
     */
    @Delete("delete from tag_file where tag_id = #{tagId}")
    void deleteByTagId(String tagId);
}
